package com.example.Holo.rework.services.implementation;

import com.example.Holo.rework.core.Friend;
import com.example.Holo.rework.dao.interfaces.IDaoFactory;
import com.example.Holo.rework.dao.interfaces.IFriendDao;
import com.example.Holo.rework.services.interfaces.IFriendService;

import java.util.List;

public class FriendService extends Service implements IFriendService {

    public FriendService(IDaoFactory daoFactory) {
        super(daoFactory);
    }

    @Override
    public List<Friend> getAllFriends(long eventId) {
        final IFriendDao friendDao = daoFactory.createFriendDao();
        return friendDao.getAllFriends(eventId);
    }

    @Override
    public long addFriend(long eventId, Friend friend) {
        final IFriendDao friendDao = daoFactory.createFriendDao();
        return friendDao.addFriend(eventId, friend);
    }

    @Override
    public int removeFriend(long eventId, long id) {
        final IFriendDao friendDao = daoFactory.createFriendDao();
        return friendDao.removeFriend(eventId, id);
    }

    @Override
    public int removeAllFriends(long eventId) {
        final IFriendDao friendDao = daoFactory.createFriendDao();
        return friendDao.removeAllFriends(eventId);
    }

    @Override
    public Friend getEventById(long id) {
        final IFriendDao friendDao = daoFactory.createFriendDao();
        return friendDao.getEntityById(id);
    }

}
